Skip to content

Add Linux X64 and Arm64 support for filekit-core - #621

Merged
vinceglb merged 5 commits into
vinceglb:mainfrom
nik1062:feature/linux-support
Jul 30, 2026
Merged

Add Linux X64 and Arm64 support for filekit-core#621
vinceglb merged 5 commits into
vinceglb:mainfrom
nik1062:feature/linux-support

Conversation

@nik1062

@nik1062 nik1062 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This PR adds linuxX64 and linuxArm64 native targets for filekit-core and implements the required PlatformFile and FileKit native Linux APIs using standard POSIX functions. #609

nik1062 and others added 3 commits July 29, 2026 16:47
- absolutePath() no longer routes through SystemFileSystem.resolve, which
  threw FileNotFoundException for relative paths of files that do not exist.
  This broke `write`/`copyTo` on any relative destination, since
  isSameLogicalFileAs() calls absolutePath() before the file is created.
  It now resolves against getcwd(), matching JVM and Windows native.
- mimeType() returned null unconditionally. It now reads the freedesktop.org
  shared-mime-info database, falling back to /etc/mime.types, cached lazily.
- Fix ktlint violations that were failing the CI lint job (import ordering,
  argument list wrapping, max line length, consecutive blank lines).
- Drop redundant .toLong() conversions on st_ctim/st_mtim and the unused
  withContext import; document why st_ctim is used for createdAt().
- Honour the XDG Base Directory rule that XDG_* variables are ignored unless
  they hold an absolute path.
- Replace findByName("linuxMain")?.dependsOn(...) with linuxMain.get() so a
  missing source set fails loudly instead of silently skipping desktopMain.
- Add a linuxX64Test CI job so the new targets are actually exercised, plus
  Linux specific absolutePath() regression tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tests

Rebased onto main (80b901d), which added two expect declarations in vinceglb#625 that
Linux had no actual for, so the merge no longer compiled:
- withPath() in jvmAndNativeMain
- resolveBookmarkData() in nonWebMain, replacing the old fromBookmarkData shape
Both are now implemented, mirroring mingwX64.

createdAt() no longer reports st_ctim. That is the inode status change time and
is updated by writes and chmod, so it was reporting a fabricated creation time.
Linux only exposes birth time via statx(STATX_BTIME), which Kotlin/Native does
not bind and which several filesystems do not support, so null is returned.
See https://man7.org/linux/man-pages/man7/inode.7.html

MIME lookup now honours the globs2 `cs` flag, so case sensitive entries such as
`*.C:cs` (C++ source) no longer collide with `*.c` (C source). Compound globs
like `*.tar.gz` stay excluded on purpose: `extension` is the segment after the
last dot, so registering them under "gz" would shadow the correct entry.

filesDir/cacheDir no longer fall back to relative `.local/share` and `.cache`
when HOME is unset, which could plant application data in the working
directory. The passwd database is consulted first and a FileKitException is
thrown if no absolute home can be resolved.

Also:
- Make the globs2 and mime.types parsers pure functions over their content so
  the matching rules are unit testable rather than host dependent.
- Collapse the two duplicated FileKitUserDirectory switches into extension
  properties so XDG keys and folder names cannot drift.
- Expand linuxTest to 25 tests covering timestamps, bookmarks, MIME matching,
  FileKit initialization and directory resolution; rename to the documented
  Subject_action_expectation convention.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vinceglb
vinceglb force-pushed the feature/linux-support branch from 4df392c to 38f2b08 Compare July 29, 2026 16:07

@vinceglb vinceglb left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nik1062, thank you very much for working on this and for bringing Linux Native support to FileKit!

I made a few changes:

  • Improved MIME type detection
  • Reused the existing XDG directory logic
  • Completed the documentation for filekit-core Linux Native support

Thanks again for your contribution 🙏

@vinceglb
vinceglb merged commit 717797d into vinceglb:main Jul 30, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants